package com.bj58.ecdata.mailreport.service.impl;

import java.util.List;

import com.bj58.ecdata.mailreport.db.CommonDao;
import com.bj58.ecdata.mailreport.db.DBConfig;
import com.bj58.ecdata.mailreport.model.IEAdd;
import com.bj58.ecdata.mailreport.service.AbstractBaseService;

public class IEAddService extends AbstractBaseService<IEAdd>{
	private CommonDao comDao = new CommonDao();
	
	public List<IEAdd> getListByCon(String condition) throws Exception {
		return getListByConditon(null, condition, null);
	}

	public IEAdd getByMainId(int id) throws Exception {
		List<IEAdd> ieAddList = getListByConditon(null, "mainId = " + id, null);
		if(ieAddList==null || ieAddList.isEmpty())
			return null;
		return ieAddList.get(0);
	}

	public boolean updateMainId(int oldID, int newID) throws Exception {
		String sql="update ie_add set mainId="+newID+ " where mainId="+oldID;
		
		comDao.executeUpdate(sql,DBConfig.db_manage.getIntType());
		return true;
	}

}
